<%@ page language="java"  pageEncoding="utf-8"%> 
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>登录</title>
<%@include file="common/jscss.jsp" %>
<script type="text/javascript">
	function login(){
		document.getElementById('login_form').submit();
		return false;
	}
	
	function modifypwd(){
		var loginName = '<s:property value="loginName"/>';
		var oldPwd = $("#old_psd").val();
		var newPwd = $("#new_psd").val();
		var pwdConf = $("#new_again_psd").val();
		if(pwdConf != newPwd){
			alert("请确认密码！");
			return ;
		}
		$.post("login!modifypwd.do",{
			loginName:loginName,
			oldPwd:oldPwd,
			newPwd:newPwd
		},function(data){
			var ret = $.parseJSON(data);
			alert(ret.msg);
			if(ret.success=='true'){
				//window.location.href="login!tologin.do";
				$("#loginPwd").val($("#new_psd").val());
				login();
			}
		});
		return false;
	}
	
	$(function(){
		$("#update_psd").validate({
				rules:{
					old_psd:{
						required:true
					},
					new_psd:{
						required:true
					},
					new_again_psd:{
						required:true,
						equalTo:"#new_psd"
					}
				},
				messages:{
					old_psd:{
						required:"原始密码不能为空！"
					},
					new_psd:{
						required:"新密码不能为空！"
					},
					new_again_psd:{
						required:"重新输入密码不能为空",
						equalTo:"两次密码输入不一致，请重新输入！"
					}
				},
				errorPlacement:function(error,element){
					error.appendTo(element.siblings("div.v_validate"));
				}
			});
			
		if('<s:property value="#request.error" />' != ''){
			alert('<s:property value="#request.error" />');
		}else if('<s:property value="#request.logined" />' == 'false'){
			$.defUnit.popDiv({
				tcID:"tc_psd",
				zzBox:"zz_box",
				isZZ:true		
			});
		}
	});
</script>
</head>

<body>
	<!-- head -->
    <div class="head mg clearfix">
    	<div class="logo">
    		<a href="#"><img src="images/common/logo.png" class="block" /></a>
        </div>
        <div class="head_name">
        	招生考试信息平台
        </div>
    </div>
    <!-- head--end -->
    
    <!-- body -->
    <div class="content">
    	<div class="login_wrap">
        	<div class="login_box clearfix">
            	<img src="images/other/login_1.png" class="block fl" />
            	<form id="login_form" action="login!login.do" method="post" onsubmit="return login();">
	                <div class="login">
	                	<ul>
	                    	<li>
	                        	<label class="def_lbl">用户名：</label><input type="text" class="def_txt" name="loginName" id="loginName" value="<s:property value="loginName"/>"/>
	                        </li>
	                        <li>
	                       		<label class="def_lbl">密&nbsp;&nbsp;码：</label><input type="password" class="def_txt" name="loginPwd" id="loginPwd" value="<s:property value="loginPwd"/>"/>
	                        </li>
	                        <li>
	                        	<input type="submit" class="def_btn" value="登&nbsp;&nbsp;录" />
	                        </li>
	                    </ul>
	                </div>
                </form>
            </div>
        </div>
    </div>
    <!-- body--end-->
    
    <!-- foot -->
    <div class="foot clearfix">
    	<img src="images/common/foot_bg.png" class="block" />
        <p class="foot_info">上海市黄浦区教育考试中心版权所有<br />Copyright&copy;2007<br />建议使用1024*768分辨率浏览<br />沪ICP备05005443</p>
    </div>
    <!-- foot--end-->
    
    <div class="update_psd_box" id="tc_psd" style=" display:none;">
    	<h3>修改密码</h3>
         <ul>
             <li>
                 <label for="old_psd" class="def_lbl">原密码：</label><input type="password" name="old_psd" class="def_txt" id="old_psd"/><div class="clear"></div><div class="v_validate"></div>
             </li>
             <li>
                 <label for="new_psd" class="def_lbl">新密码：</label><input type="password" name="new_psd" class="def_txt" id="new_psd" /><div class="clear"></div><div class="v_validate"></div>
             </li>
             <li>
                 <label for="new_again_psd" class="def_lbl">重新输入：</label><input type="password" name="new_again_psd" id="new_again_psd" class="def_txt" /><div class="clear"></div><div class="v_validate"></div>
             </li>
             <li><input type="button" class="def_btn" style="float: left;margin-left:50px;" value="确&nbsp;&nbsp;定" onclick="modifypwd();"/><input type="button" class="def_btn" style="float: left;margin-left:10px;" value="取&nbsp;&nbsp;消" onclick="$('#tc_psd').hide();$('.zz_box').remove();"/></li>
         </ul>
    </div>
</body>
</html>
